#include "Vector3D.h"


float Vector3D::CalculateMagnitude()
{
	magnitude = sqrt(fX * fX + fY * fY + fZ * fZ);
	return magnitude;
}

float Vector3D::DistanceTo(Vector3D second)
{
	float dist = sqrt((fX - second.getX())*(fX - second.getX()) + 
					(fY - second.getY())*(fY - second.getY()) + 
					(fZ - second.getZ())*(fZ - second.getZ()));
	return dist;
}

float Vector3D::dot(Vector3D second)
{
	return  ((fX * second.getX()) + (fY * second.getY()) + (fZ * second.getZ()));
}

Vector3D Vector3D::operator +(Vector3D onRight)
{
	Vector3D sum(fX + onRight.getX(), fY + onRight.getY(), fZ + onRight.getZ());
	return sum;
}

Vector3D Vector3D::operator -(Vector3D onRight)
{
	Vector3D difference(fX - onRight.getX(), fY - onRight.getY(), fZ - onRight.getZ());
	return difference;
}

Vector3D Vector3D::operator *(float onRight)
{
	Vector3D product(fX * onRight, fY * onRight, fZ * onRight);
	return product;
}

ostream& operator <<(ostream& out, Vector3D v)
{
	out << "(" << v.getX() << ", " << v.getY() << ", " << v.getZ() << ")";
	return out;
}